package som.simon.reactor;

import reactor.core.publisher.Flux;
import reactor.core.scheduler.Schedulers;

public class ParallelMain {

    public static void main(String[] args) {

        Flux.range(1, 1000000)
                .map(SimonUtil::format)
                // .delayElements(Duration.ofSeconds(1))
                .buffer(1000)
                .parallel(8)
                .runOn(Schedulers.newParallel("one"))
                .log()
                .flatMap(Flux::fromIterable)
                .collectSortedList(String::compareTo)
                .subscribe(v -> {});

        SimonUtil.pause();

    }

}
